<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" errorPage="500.jsp"%>
<%@ taglib uri="http://www.duyiedu.com" prefix="myFn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <title>订单管理</title>
    <link rel="stylesheet" href="../admin_css/userOrder.css">
    <link rel="stylesheet" href="../admin_css/iconfont/iconfont.css">
    <script src="../admin_js/jquery-1.12.4.js"></script>
</head>
<body>
<div class="content">
    <div class="container" style="padding: 0px; width: 100% ;">
    <div class="tou"><span class="iconfont icon-layer"></span><span style="font-weight: bold; margin-left: 6px;">用户订单管理</span></div>
    <table class="table">
        <caption><span id="sum" style="margin-left: 30px;">共${fn:length(sessionScope.orders)}条</span></caption>
        <thead>
        <tr>
            <th>订单号</th>
            <th>用户昵称</th>
            <th>电影名称</th>
            <th>座位</th>
            <th>放映厅</th>
            <th>订单时间</th>
            <th>订单总金额</th>
            <th>订单状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table">
        <c:if test="${!empty orders}">
		   	<c:forEach items="${orders}" var="o">	
            <tr>	
                <td>${o.orderNum}</td>
                <td>${o.user.uNickName}</td>
                <td>${o.showings.film.filmName}</td>
               	<td>
               		<c:forEach items="${o.seats}" var="seat" varStatus="index">
               			${myFn:formatSeatNumber(seat.seatNumber)}
               			<c:if test="${!index.last}">
               				、
               			</c:if>
               		</c:forEach>
               	</td>
                <td>${o.showings.filmOffice.offName}</td> 
                <td>${o.date} ${myFn:formatTime(o.time)}</td> 
                <td><fmt:formatNumber type="number" value=" ${o.showings.showingsPrice * fn:length(o.seats)}" pattern="#.0" /></td> 
                <td>
                	<c:if test="${o.orderFlag == 1}">
                		已完成
                	</c:if>
                	<c:if test="${o.orderFlag == 0}">
                		待支付
                	</c:if>
                </td>
                <td>
                    <a href="${pageContext.request.contextPath}/removeAdminOrder.do?orderNum=${o.orderNum}"><button class="btn btn-default removeBtn" style="border:1px solid red;"><span>删除</span></button></a>
                </td>
            </tr> 
        	 </c:forEach>
   		 </c:if>
        </tbody>
    </table>
</div>
</div>
</body>
</html>